package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.Customize;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ICustomizeService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/customize")
public class CustomizeController {
    @Autowired
    ICustomizeService customizeService;

    @RequestMapping("update")
    public JSONResult update(Long state,Long id){
            JSONResult result = new JSONResult();
        try {
            customizeService.update(state,id);
        } catch (Exception e) {
            result.mark(e.getMessage());
        }
        return result;
    }

    @RequestMapping("list")
    public String list( @ModelAttribute("qo")QueryObject qo, Model model){
       model.addAttribute("result", customizeService.list(qo));
        return "user/travelservice";


    }
}
